<template>
  <view class="comp-loading-v2">
    <view class="comp-loading-v2__main">
      <view class="comp-loading-v2__icon">
        <view class="one comp-loading-v2__icon-item"></view>
        <view class="two comp-loading-v2__icon-item"></view>
        <view class="three comp-loading-v2__icon-item"></view>
        <view class="four comp-loading-v2__icon-item"></view>
        <view class="five comp-loading-v2__icon-item"></view>
      </view>
      <view class="comp-loading-v2__text ellipsis">{{ text }}</view>
    </view>
  </view>
</template>

<script>
export default {
  props: {
    text: String,
  }
};
</script>

<style lang="scss">
.comp-loading-v2 {
  display: flex;
  flex-flow: column nowrap;
  justify-content: space-between;
  align-items: center;
  padding: 30rpx 30rpx;
  box-sizing: border-box;
  z-index: 1000;

  &__main {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 220rpx;
    height: 220rpx;
    border-radius: 20rpx;
    background: rgba(0, 0, 0, 0.65);
    display: flex;
    flex-flow: column nowrap;
    justify-content: center;
    align-items: center;
    z-index: 10000;
  }

  &__icon {
    width: auto;
    height: 60rpx;
    color: #fff;

    &-item {
      display: inline-block;
      vertical-align: middle;
      -webkit-animation: jump-animation 0.9s -0.5s infinite cubic-bezier(0.11, 0.49, 0.38, 0.78);
      animation: jump-animation 0.9s -0.5s infinite cubic-bezier(0.11, 0.49, 0.38, 0.78);
      width: 4rpx;
      height: 48rpx;
      background: #fff;
      margin-right: 8rpx;
    }

    &.second,
    &.four {
      -webkit-animation-delay: -0.25s !important;
      animation-delay: -0.25s !important;
    }

    &.one,
    &.five {
      -webkit-animation-delay: 0s !important;
      animation-delay: 0s !important;
    }

    &.five {
      margin-right: 0;
    }
  }

  &__text {
    color: #fff;
    font-size: 22rpx;
    margin-top: 20rpx;
    padding: 0 20rpx;
  }
}
</style>
